package Day003_多态_内部类.demo003实现多态的形式;

/*
    多态的几种表现形式:
                    1.普通父类多态:
                            public class Fu{
                                public void method(){}
                            }
                            public class Zi extends Fu{
                                public void method(){}
                            }
                            main(){
                                Fu fu = new Zi();  父类的引用指向子类对象
                            }
                    2.抽象父类多态:
                            public abstract class Fu{
                                public abstract void method(){}
                            }
                            public class Zi extends Fu{
                                public void method(){}
                            }
                            main(){
                                Fu fu = new Zi();  父类的引用指向子类对象
                            }
                   3.接口多态:
                            public interface A{
                                public abstract void method(){}
                            }
                            public ImpA implements A{
                                public void method(){}
                            }
                            main(){
                                A a = new ImpA();  父接口的引用指向实现类对象
                            }
 */

public class Test {
    public static void main(String[] args) {

        A a = new ImpA(); // 父接口的引用指向实现类对象
        a.method();
    }
}
